<template>
	<!-- 内容组件 -->
	<view class="list" :style="{'paddingTop':paddingTop}">
		<view class="uni-margin-wrap">
			<swiper class="swiper" :duration="200" :current="labelInfo.tabIndex" @change="onswiperchange">
				<!-- 内容选项卡 -->
					<swiper-item>
						<!-- 阅读插槽 -->
						<slot name="read"></slot>
					</swiper-item>
					<swiper-item>
						<!-- 图文插槽 -->
						<slot name="imageText"></slot>
					</swiper-item>
					<swiper-item>
						<!-- 问答插槽 -->
						<slot name="answer"></slot>
					</swiper-item>
					<swiper-item>
						<!-- 关注插槽 -->
						<slot name="notes"></slot>
					</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	export default {
		name: "list",
		props: {
			labelInfo: {
				type: Object,
				default: {}
			},
			//距离顶部
			paddingTop: {
				type: String,
				default: '80rpx'
			}
		},
		components: {

		},
		data() {
			return {
				tabIndex: 0, //当前选中的项下标
			};
		},
		methods: {
			//视图滑动切换的时候，根据current来改变顶部栏的状态
			onswiperchange(e) {
				this.tabIndex = e.detail.current;
				console.log(e.detail.current);
				this.$emit("swiperIndex", e.detail.current)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		// padding-top: 80rpx;
		height: 100%;
		width: 100%;

		/deep/ .swiper {
			height: 900px;
		}
	}
</style>
